<template>
  <div class="header">
    <div class="header-left">
      <div class="iconfont back-icon">&#xe624;</div>
    </div>
    <div class="header-input">
      <span class="iconfont input-icon">&#xe632;</span> 输入城市/景点/游玩主题
    </div>
    <router-link to="/city">
      <div class="header-right">
         {{ currentCity }} {{ doubleCity }} {{ myName }}<span class="iconfont">&#xe6c5;</span>
      </div>
    </router-link>
  </div>
</template>

<script>
import { mapState, mapGetters } from 'vuex'

export default {
  name: 'Header',
  props: {
    city: String
  },
  computed: {
    myName: function () {
      return 'wujiedong'
    },
    ...mapState({
      // 'city'等同于state.city
      currentCity: 'city'
    }),
    ...mapGetters({
      doubleCity: 'doubleCity'
    })
  }
}
</script>

<style lang="stylus" scoped>
  @import "~styles/varibles.styl"
  .header
    display flex
    flex-direction row
    background $headerColor
    height $headerHeight
    line-height 0.8rem
    .header-left
      width 0.8rem
      float left
    .back-icon
      color #ffffff
      font-size 0.4rem
      text-align center
    .header-input
      margin-top 0.1rem
      height 0.6rem
      line-height 0.6rem
      background #ffffff
      flex 1
      border-radius 0.1rem
      color #e4e7ea
      .input-icon
        padding-left 0.1rem
    .header-right
      float right
      text-align right
      padding-right 0.2rem
      padding-left 0.2rem
      color #ffffff
</style>
